package com.iceph0x.algorithm.test;

public class DebugUtil {
    
    public static boolean enable = true;
    
    public static void print(int[] data) {
        if (!enable)
            return;
        
        if (data == null)
            System.out.println("DebugUtil::data is null!");
        if (data.length == 0)
            System.out.println("DebugUtil::data'size is zero!");
        
        System.out.println("***************************************");
        for (int i = 0; i < data.length; ++i) {
            System.out.print(data[i]);
            System.out.print(" ");
            if ((i & 0xf) == 0xf)
                System.out.println();
        }
    }
    
    public static int[] copyArray(int[] data) {
        if (data == null)
            return null;
        
        int[] copyData = new int[data.length];
        System.arraycopy(data, 0, copyData, 0, data.length);
        return copyData;
    }
}
